package a_doubleWrite;

/**
 * 盛水最多的容器
 *
 * @author: luolidong
 * @create: 2021-07-18 09:26
 * @version: 1.0
 */
public class L11 {
    public int maxArea(int[] height) {
        int length = height.length-1;
        int left=0;
        int right=length;
        int max=0;
        while (left<right){
            if(height[left]<height[right]){
                max=Math.max(height[left]*(right-left), max);
                left++;
            }else {
                max=Math.max(height[right]*(right-left), max);
                right--;
            }
        }
        return max;
    }

    public static void main(String[] args) {
        L11 l11 = new L11();
        int i = l11.maxArea(new int[]{1, 1});
        System.out.println(i);
    }
}
